home *** CD-ROM | disk | FTP | other *** search
/ Internet Info 1997 December / Internet_Info_CD-ROM_Walnut_Creek_December_1997.iso / ietf / urn / urn-archives / urn-ietf.archive.9608 / 000015_owner-urn-ietf _Fri Aug 16 15:49:53 1996.msg < prev    next >
Internet Message Format  |  1997-02-19  |  33KB

  1. Received: (from daemon@localhost) by services.bunyip.com (8.6.10/8.6.9) id PAA19801 for urn-ietf-out; Fri, 16 Aug 1996 15:49:53 -0400
  2. Received: from mocha.bunyip.com (mocha.Bunyip.Com [192.197.208.1]) by services.bunyip.com (8.6.10/8.6.9) with SMTP id PAA19789 for <urn-ietf@services.bunyip.com>; Fri, 16 Aug 1996 15:49:45 -0400
  3. Received: from acl.lanl.gov by mocha.bunyip.com with SMTP (5.65a/IDA-1.4.2b/CC-Guru-2b)
  4.         id AA26560  (mail destined for urn-ietf@services.bunyip.com); Fri, 16 Aug 96 15:49:35 -0400
  5. Received: from magenta.acl.lanl.gov (magenta.acl.lanl.gov [128.165.147.153]) by acl.lanl.gov (8.7.3/8.7.3) with ESMTP id NAA22099 for <urn-ietf@bunyip.com>; Fri, 16 Aug 1996 13:49:34 -0600 (MDT)
  6. From: "Ronald E. Daniel" <rdaniel@acl.lanl.gov>
  7. Received: (rdaniel@localhost) by magenta.acl.lanl.gov (8.6.9/8.6.4) id NAA07281 for urn-ietf@bunyip.com; Fri, 16 Aug 1996 13:49:33 -0600
  8. Date: Fri, 16 Aug 1996 13:49:33 -0600
  9. Message-Id: <199608161949.NAA07281@magenta.acl.lanl.gov>
  10. To: urn-ietf@bunyip.com
  11. Subject: [URN] revision 1 of the NAPTR draft
  12. Sender: owner-urn-ietf@services.bunyip.com
  13. Precedence: bulk
  14. Reply-To: "Ronald E. Daniel" <rdaniel@acl.lanl.gov>
  15. Errors-To: owner-urn-ietf@bunyip.com
  16.  
  17. INTERNET DRAFT                                                  Ron Daniel
  18. draft-daniel-naptr-01.txt                   Los Alamos National Laboratory
  19.                                                           Michael Mealling
  20.                                            Georgia Institute of Technology
  21.                                                               16 Aug, 1996
  22.  
  23.  
  24.               Resolution of Uniform Resource Identifiers
  25.                      using the Domain Name System
  26.  
  27.  
  28. Status of this Memo
  29. ===================
  30.  
  31.     This document is an Internet-Draft.  Internet-Drafts are working
  32.     documents of the Internet Engineering Task Force (IETF), its
  33.     areas, and its working groups.  Note that other groups may also
  34.     distribute working documents as Internet-Drafts.
  35.   
  36.     Internet-Drafts are draft documents valid for a maximum of six
  37.     months and may be updated, replaced, or obsoleted by other
  38.     documents at any time.  It is inappropriate to use Internet-
  39.     Drafts as reference material or to cite them other than as
  40.     ``work in progress.''
  41.   
  42.     To learn the current status of any Internet-Draft, please check
  43.     the ``1id-abstracts.txt'' listing contained in the Internet-
  44.     Drafts Shadow Directories on ftp.is.co.za (Africa),
  45.     nic.nordu.net (Europe), munnari.oz.au (Pacific Rim),
  46.     ds.internic.net (US East Coast), or ftp.isi.edu (US West Coast).
  47.  
  48.     This draft expires 16 Feb., 1997.
  49.   
  50.   
  51.  
  52. Abstract:
  53. =========
  54.  
  55. Uniform Resource Locators (URLs) are the foundation of the World Wide
  56. Web, and are a vital Internet technology. However, they have proven to
  57. be brittle in practice. The basic problem is that URLs typically
  58. identify a particular path to a file on a particular host. There is no
  59. graceful way of changing the path or host once the URL has been
  60. assigned. Neither is there a graceful way of replicating the resource
  61. located by the URL to achieve better network utilization and/or fault
  62. tolerance. Uniform Resource Names (URNs) have been hypothesized as a
  63. replacement for URLs that would overcome such problems. URNs and URLs
  64. are both instances of a broader class of identifiers known as Uniform
  65. Resource Identifiers (URIs).
  66.  
  67. This document describes a new DNS Resource Record, NAPTR (Naming
  68. Authority PoinTeR), that provides rules for mapping parts of URIs to
  69. domain names.  By changing the mapping rules, we can change the host
  70. that is contacted to resolve a URI. This will allow a more graceful
  71. handling of URLs over long time periods, and forms the foundation for a
  72. new proposal for Uniform Resource Names.
  73.  
  74. In addition to locating resolvers, the NAPTR provides for other naming
  75. systems to be grandfathered into the URN world, provides independence
  76. between the name assignment system and the resolution protocol system,
  77. and allows multiple services (Name to Location, Name to Description,
  78. Name to Resource, ...) to be offered.  In conjunction with the SRV RR
  79. proposal [3], the NAPTR record allows those services to be replicated
  80. for the purposes of fault tolerance and load balancing.
  81.  
  82.  
  83. Introduction:
  84. =============
  85.  
  86. Uniform Resource Locators have been a significant advance in locating
  87. resources on the Internet. However, their  brittle nature over time
  88. has been recognized for several years. The Uniform Resource Identifer
  89. working group proposed the development of Uniform Resource Names to serve
  90. as persistent, location-independent identifiers for Internet resources
  91. in order to overcome most of the problems with URLs. RFC-1737 [1] sets
  92. forth requirements on URNs.
  93.  
  94. Even if URN systems were in place now, there would still be a
  95. tremendous number of URLs.  It should be possible to develop a URN
  96. resolution system that can also provide location independance for those
  97. URLs.  This is related to the requirement in [1] to be able to
  98. grandfather in names from other naming systems, such as ISO Formal
  99. Public Identifiers, Library of Congress Call Numbers, ISBNs, ISSNs,
  100. etc.
  101.  
  102. The developers of various URN proposals have held a series of meetings,
  103. resulting in a compromise known as the Knoxville framework. The
  104. major principle behind the Knoxville framework is that any name
  105. assignment hierarchy should be seperate from the resolution hierarchy.
  106. This is in marked contrast to the Domain Name System, where the two are
  107. identical.  Readers are referred to [2] for background on the Knoxville
  108. framework for additional information on the context and purpose of this
  109. proposal.
  110.  
  111. For the reasons mentioned earlier, we want to be able to resolve URNs
  112. and URLs within the same framework. For the short term, DNS is the
  113. obvious candidate for the resolution framework, since it is widely
  114. deployed and understood. However, it is not appropriate to use DNS to
  115. maintain information on a per-resource basis. First of all, DNS was
  116. never intended to handle that many records.  Second, the limited record
  117. size is inappropriate for catalog information.  Third, we have the
  118. requirement mentioned above about grandfathering of other name
  119. systems.
  120.  
  121. Therefore our approach is to use DNS to locate "resolvers" that can
  122. provide information on individual resources, potentially including the
  123. resource itself. To accomplish this, we "rewrite" the URI into a domain
  124. name following the rules provided in NAPTR records. Rewrite rules
  125. provide considerable power, which is important when trying to seperate
  126. the name assignment and resolution procedures. However, collections of
  127. rules can become difficult to understand. To lessen this problem, the
  128. NAPTR rules are *always* applied to the original URI, *never* to the
  129. output of previous rules.
  130.  
  131. Locating a resolver through the rewrite procedure may take multiple
  132. steps, but the beginning is always the same. Every URI has a
  133. colon-delimited prefix.  NAPTR resolution begins by taking this prefix,
  134. appending the well-known suffix ".urn.net", and querying DNS for NAPTR
  135. records at that domain name.  Based on the results of this query, zero
  136. or more additional DNS queries may be needed to locate resolvers for the
  137. URI. Three brief examples of this procedure are given in the next
  138. section.
  139.  
  140. The NAPTR RR provides the level of indirection needed to keep the naming
  141. system independent of the resolution system, its protocols, and services.
  142. Coupled with the new SRV resource record proposal[3] there is also the
  143. potential for replicating the resolver on multiple hosts, overcoming some
  144. of the most significant problems of URLs. This is an important and subtle
  145. point. Not only do the NAPTR and SRV records allow us to replicate
  146. the resource, we can replicate the resolvers that know about the replicated
  147. resource. Preventing a single point of failure at the resolver level
  148. is a significant benefit. 
  149.  
  150.  
  151. Terminology
  152. ===========
  153.  
  154. "Must" or "Shall" - Software that does not behave in the mannar that this
  155.            document says it must is not conformant to this document.
  156. "Should" - Software that does not follow the behavior that this document
  157.            says it should may still be conformant, but is probably broken
  158.            in some fundamental way.
  159. "May" -    Implementations may or may not provide the described behavior,
  160.            while still remaining conformant to this document.
  161.  
  162.  
  163. Brief overview and examples of the NAPTR RR:
  164. ============================================
  165.  
  166. A detailed description of the NAPTR RR will be given later, but to give
  167. a flavor for the proposal we first give a simple description of the
  168. record and three examples of its use.
  169.  
  170. The key fields in the NAPTR RR are order, preference, service, flags,
  171. replacement, and regexp:
  172. * The order field specifies the order in which records MUST
  173.   be processed when multiple  NAPTR records are returned in response to
  174.   a single query. A naming authority may have delegated a portion of its
  175.   namespace to another agency. Evaluating the NAPTR recors in the correct
  176.   order is necessary for delegation to work properly.
  177. * The preference field specifies the order in which records SHOULD
  178.   be processed when multiple NAPTR records have the same value of "order".
  179.   This field lets a service provider specify the order in which resolvers
  180.   are contacted, so that more capable machines are contacted in preference
  181.   to less capable ones.
  182. * The service field specifies the resolution protocol and resolution
  183.   service(s) that will be available if the rewrite specified by the
  184.   regexp or replacement fields is applied. Resolution protocols are
  185.   the protocols used to talk with a resolver, and will be specified in
  186.   other documents. Resolution services are operations such as
  187.   N2R (URN to Resource), N2L (URN to URL), N2C (URN to URC), etc.
  188.   These are discussed in the URN Framework document[2], and
  189.   their behavior in a particular resolution protocol will be given in
  190.   the specification for that protocol.
  191. * The flags field contains modifiers that affect what happens in the
  192.   next DNS lookup, typically for optimizing the process.
  193. * The replacement field is one of two fields used for the rewrite rules.
  194.   If the rewrite is a simple substitution of a domain name, that name is
  195.   given in the replacement field. The replacement field is a domain name
  196.   (subject to compression if a DNS sender knows that a given recipient is
  197.   able to decompress names in this RR type's RDATA field). If the rewrite
  198.   is more complex than a simple substitution of a domain name, the
  199.   replacement field should be set to . and the regexp field used.
  200. * The regexp field is the other field that may be used for rewrite rules.
  201.   The regexp field is a String containing sed-style substitution expressions.
  202.   These are applied to the original URN and yield the next domain name
  203.   to be queried.
  204.  
  205. Note that the client applies all the substitutions and performs all
  206. lookups - this is not handled in DNS servers. Note also that there is no
  207. reason to provide values in both the replacement and regexp field. Only
  208. one should be specified. If a value is specified in both, the
  209. replacement name MUST be used and the regexp string MUST be ignored. It
  210. is the belief of the developers of this document that regexps should
  211. rarely be used. The replacement field seems adequate for the vast majority
  212. of situations.
  213.  
  214.  
  215. Example 1
  216. ---------
  217.  
  218. Consider a URN that uses the DUNS namespace. DUNS numbers are
  219. identifiers for approximately 30 million registered businesses around
  220. the world, assigned and maintained by Dunn and Bradstreet. The URN
  221. might look like:
  222.  
  223.                  urn:duns:002372413:annual-report-1997
  224.  
  225. The first step in the resolution process is to find out about the DUNS
  226. namespace. The namespace identifier, duns, is extracted from the URN,
  227. prepended to urn.net, and the NAPTRs for duns.urn.net looked up. It might
  228. return records of the form:
  229.  
  230. duns.urn.net
  231. ;;      order pref flags service            replacement                regexp
  232.  IN NAPTR 100  10  "s"  "dunslink+N2L+N2C" _dunslink._udp.isi.dandb.com   ""
  233.  IN NAPTR 100  20  "s"  "rcds+N2C"         _rcds._udp.isi.dandb.com       ""
  234.  IN NAPTR 100  30  "s"  "http+N2L+N2C+N2R" _http._tcp.isi.dandb.com       ""
  235.  
  236. The order field contains equal values, indicating that no name delegation
  237. order has to be followed. The preference field indicates that the provider
  238. would like clients to use the special dunslink protocol, followed by
  239. the RCDS protocol, and that HTTP is offered as a last resort. All the
  240. records specify the "s" flag, which will be explained momentarily.
  241. The service fields say that if we speak dunslink, we will be able to
  242. issue either the N2L or N2C requests to obtain a URL or a URC (description)
  243. of the resource. The Resource Cataloging and Distribution Service (RCDS) could
  244. be used to get a URC for the resource, while HTTP could be used to get
  245. a URL, URC, or the resource itself.  All the records supply the next
  246. domain name to query, none of them need to be rewritten with the aid of
  247. regular expressions.
  248.  
  249. The general case might require multiple NAPTR rewrites to locate a
  250. resolver, but eventually we will come to the "terminal NAPTR". Once we
  251. have the terminal NAPTR, our next probe into the DNS will be for a SRV 
  252. or A record instead of another NAPTR. Rather than probing for a non-existant
  253. NAPTR record to terminate the loop, the flags field is used to indicate
  254. a terminal lookup. If it has a value of "s", the next lookup should
  255. be for SRV RRs, "a" denotes that A records should sought.
  256.  
  257.  
  258. Since our example RR specified the "s" flag, it was terminal. Our
  259. next action is to lookup SRV RRs for _rcds._udp.isi.dandb.com, which
  260. will tell us hosts that can provide the necessary resolution service. 
  261. That lookup might return:
  262.  
  263. ;;                              Pref Weight Port Target
  264.   rcds._udp.isi.dandb.com IN SRV 0    0    1000 defduns.isi.dandb.com
  265.                           IN SRV 0    0    1000 dbmirror.com.au
  266.                           IN SRV 0    0    1000 ukmirror.com.uk
  267.  
  268. telling us three hosts that could actually do the resolution, and
  269. giving us the port we should use to talk to their RCDS server.
  270. (The reader is referred to the SRV proposal [3] for the interpretation
  271. of the fields above).
  272.  
  273. Since a domain administrator knows certain NAPTRs are terminal,  (s)he
  274. might include the corresponding SRV RRs as additional info. Further,
  275. the SRV RRs could include A records as additional info.  While this
  276. recursive provision of additional information is not explicitly blessed
  277. in the DNS specifications, it is not forbidden, and BIND does take
  278. advantage of it [4].  This is a significant optimization. In
  279. conjunction with a long TTL for *.urn.net records, the average number
  280. of probes to DNS for resolving DUNS URNs would approach one.
  281.  
  282. Records MUST be processed in the order specified by the order field.
  283. This allows administrators to say that "all records matching this
  284. pattern go to server1, all others go to server2". Records SHOULD be
  285. processed in the order specified in the preference field. However,
  286. clients may have a preference for particular protocols and resolution
  287. services that causes them to ignore the preference field, so resolver
  288. administrators cannot count on the preference field always being
  289. respected.
  290.  
  291.  
  292.  
  293. Example 2 
  294. ---------
  295.  
  296. Consider a URI namespace based on MIME Content-Ids.
  297. The URN might look like this:
  298.   
  299.         urn:cid:199606121851.1@mordred.gatech.edu
  300.   
  301. The first step in the resolution process is to find out about the CID
  302. namespace. The namespace identifier, cid, is extracted from the URN,
  303. prepended to urn.net, and the NAPTR for cid.urn.net looked up. It might
  304. return records of the form:
  305.  
  306. ;;                  order pref flags service replacement       regexp
  307. cid.urn.net IN NAPTR 100  10   ""     ""       .        "/.+@([^@]+)/\1/i"
  308.  
  309. We have only one NAPTR response, so ordering the responses is not a
  310. problem.  The replacement field is empty, so we check the regexp field
  311. and use the pattern provided there. We apply that regexp to the entire
  312. URN to see if it matches, which it does.  The \1 part of the regexp
  313. returns the string "mordred.gatech.edu". Since the flags field is
  314. empty, the lookup is not terminal, and our next probe to DNS is for
  315. NAPTR records. The result might look something like:
  316.  
  317. *.gatech.edu IN NAPTR
  318. ;;     order pref flags service           replacement             regexp
  319. IN NAPTR 100  50  "s"  "z39.50+N2L+N2C"   _z3950._tcp.gatech.edu    ""
  320. IN NAPTR 100  50  "s"  "rcds+N2C"         _rcds._udp.gatech.edu     ""
  321. IN NAPTR 100  50  "s"  "http+N2L+N2C+N2R" _http._tcp.gatech.edu     ""
  322.  
  323. Note that a wildcard has been used so that the domain administrator
  324. at Georgia Tech has only a single NAPTR record to maintain. The
  325. values of the order and preference fields are equal in all records, so
  326. we are free to pick any record.
  327. The flags field tells us that this is the last NAPTR patterns we
  328. should see, and after the rewrite (a simple replacement in this case) we
  329. should look up SRV records to get information on the hosts 
  330. that can provide the necessary service.  Assuming we prefer the Z39.50
  331. protocol, our lookup might return:
  332.  
  333. ;;                            Pref Weight Port Target
  334. _z3950._tcp.gatech.edu IN SRV 0    0      1000 z3950.gatech.edu
  335.                        IN SRV 0    0      1000 z3950.cc.gatech.edu
  336.                        IN SRV 0    0      1000 z3950.uga.edu
  337.  
  338. telling us three hosts that could actually do the resolution, and
  339. giving us the port we should use to talk to their Z39.50 server.
  340.  
  341. Users of regular expressions should note that there is a significant
  342. caveat about the use of backslashes in DNS zone files. DNS treats
  343. backslashes as the escape character so that '.' can be escaped when
  344. necessary. This means that when a regular expression is entered into
  345. the zone file, the backslashes must be escaped by another backslash.
  346. For the case of the cid.urn.net record above, the regular expression
  347. entered into the zone file should be "/.+@([^@]+)/\\1/i".  When the
  348. client code actually recieves the record, the pattern will have been
  349. converted to "/.+@([^@]+)/\1/i".
  350.  
  351. Example 3
  352. ---------
  353.  
  354. As mentioned above, the NAPTR RR can also be used for URLs that have
  355. already been assigned. Assume we have the URL for a very popular piece
  356. of software that the publisher wishes to mirror at multiple sites around
  357. the world:
  358.  
  359.      http://www.foo.com/software/latest-beta.exe
  360.  
  361. We extract the prefix, "http", and lookup NAPTR records for
  362. http.urn.net. This might return a record of the form
  363.  
  364. http.urn.net IN NAPTR
  365. ;;  order   pref flags service replacement          regexp
  366.      100     90   ""      ""        .        "/.*\/\/([^\/:]+)/\1/i"
  367.  
  368. This expression returns everything after the first double slash and
  369. before the next slash or colon. Backslashes are needed to escape the
  370. forward slash since the forward slash character is what seperates the
  371. components of the substitution pattern. (Recall from the previous
  372. example that in the zone file, this pattern actually needs to be
  373. entered as "/.*\\/\\/([^\\/:]+)/\\1/i").  Applying this pattern to the
  374. URL extracts "www.foo.com". Looking up NAPTR records for that might
  375. return:
  376.  
  377. www.foo.com
  378. ;;       order pref flags   service     replacement      regexp
  379.  IN NAPTR 100  100  "s"   "http+L2R" _http._tcp.foo.com   ""
  380.  IN NAPTR 100  100  "s"   "ftp+L2R"  _ftp._tcp.foo.com    ""
  381.  
  382. Looking up SRV records for _http._tcp.foo.com would return information
  383. on the hosts that foo.com has designated to be its mirror sites. The
  384. client can then pick one for the user. 
  385.  
  386.  
  387. NAPTR RR Format
  388. ===============
  389.  
  390. The format of the NAPTR RR is given below. The DNS type code for
  391. NAPTR is 104.
  392.  
  393.     Domain TTL Class Order Preference Flags Service Replacement Regexp
  394.  
  395. where:
  396.  
  397. Domain
  398.        The domain name this resource record refers to.
  399. TTL
  400.        Standard DNS Time To Live field
  401. Class
  402.        Standard DNS meaning
  403. Order
  404.        A 16-bit integer specifying the order in which the NAPTR records
  405.        MUST be processed to ensure correct delegation of portions
  406.        of the namespace over time. Low numbers are processed before
  407.        high numbers, and once a NAPTR is found that "matches" a URN,
  408.        the client MUST NOT consider any NAPTRs with a higher value
  409.        for order.
  410.  
  411. Preference
  412.        A 16-bit integer which specifies the order in which NAPTR records
  413.        with equal "order" values SHOULD be processed, low numbers
  414.        being processed before high numbers.  This is similar to the
  415.        preference field in an MX record, and is used so domain
  416.        administrators can direct clients towards more capable hosts
  417.        or lighter weight protocols. 
  418.  
  419. Flags
  420.        A String giving flags to control aspects of the rewriting. Flags
  421.        are single characters from the alphabet [A-Z0-9]. The case of
  422.        the alphabetic characters is not significant.
  423.  
  424.        At this time only two flags, "S" and "A", are defined. "S" means
  425.        that the next lookup should be for SRV records instead of NAPTR
  426.        records. "A" means that the next lookup should be for A records.
  427.        The S and A flags are mutually exclusive, and resolution libraries
  428.        SHOULD signal and error so that bad NAPTRs can be quickly detected.
  429.  
  430.        The remaining alphabetic flags are reserved. The numeric flags
  431.        may be used for local experimentation.
  432.  
  433. Service 
  434.        Specifies the resolution service(s) available down this rewrite
  435.        path. May also specify the particular protocol that is used to
  436.        talk with a resolver. If a protocol is specified in the service
  437.        field, the rewrite will almost certainly be terminal, although the
  438.        flags field MUST still be considered the authoritative source of
  439.        information on that subject.
  440.  
  441.        The service field may take any of the values below (using the
  442.        Augmented BNF of RFC 822[5]):
  443.  
  444.            service_field = [ [protocol] *("+" rs)]
  445.            protocol      = "RCDS" / "HTTP"
  446.            rs            = "N2L" / "N2Ls" / "N2R" / "N2Rs" / "N2C"
  447.                          / "L2R" / "L2C"
  448.  
  449.        i.e. an optional protocol specification followed by 0 or more
  450.        resolution services. Each resolution service is indicated by
  451.        an initial '+' character.
  452.  
  453.        Note that the empty string is also a valid service field. This
  454.        will typically be seen at the top levels of a namespace, when it
  455.        is impossible to know what services and protocols will be offered
  456.        by a particular publisher within that name space.
  457.  
  458.        At this time the known protocols are RCDS (a binary, UDP-based
  459.        protocol) and HTTP (a textual, TCP-based protocol). More will be
  460.        allowed later. At this time the allowed service requests are:
  461.              N2L  - Given a URN, return a URL
  462.              N2Ls - Given a URN, return a set of URLs
  463.              N2R  - Given a URN, return an instance of the resource.
  464.              N2Rs - Given a URN, return multiple instances of the resouce,
  465.                     typically encoded using multipart/alternative.
  466.              N2C  - Given a URN, return a collection of meta-information on
  467.                     the named resource. The format of this response is the
  468.                     subject of another document.
  469.              L2R  - Given a URL, return the resource.
  470.              L2C  - Given a URL, return a description of the resource.
  471.        The actual format of the service request and response will be
  472.        determined by the resolution protocol, and is the subject for other
  473.        documents.
  474.  
  475. Replacement
  476.        The next NAME to query for NAPTR, SRV, or A records depending on
  477.        the value of the flags field. 
  478.  
  479. Regexp
  480.        A STRING containing a sed(1)-style substitution expression that is
  481.        applied to the original URI in order to construct the next name to
  482.        lookup. For example:
  483.          "/^.*inet:([^:]+):*/\\1/i"
  484.                Regular expression replacement. The URN will be searched
  485.                from the beginning for the pattern "inet:". All characters
  486.                after that colon, up to but not including the next colon,
  487.                will form the next domain name to be looked up.  The /i
  488.                flag says that the match will be case-insensitive, so
  489.                IneT, Inet, INET, ... would all be matched. The new
  490.                search key would also be normalized to lower case.
  491.  
  492. Advice to domain administrators:
  493. ================================
  494.  
  495. Beware of regular expressions. Not only are they a pain to get
  496. correct on their own, but there is the previously mentioned interaction
  497. with DNS. Any backslashes in a regexp must be entered twice in a zone
  498. file in order to appear once in a query response. More seriously, the
  499. need for double backslashes has probably not been tested by all
  500. implementors of DNS servers. We anticipate that urn.net will be the
  501. heaviest user of regexps. Only when delegating portions of namespaces
  502. should the typical domain administrator need to use regexps.
  503.  
  504. On a related note, beware of interactions with the shell when manipulating
  505. regexps from the command line. Since '\' is a common escape character in
  506. shells, there is a good chance that when you think you are saying "\\" you
  507. are actually saying "\".
  508.  
  509. Administrators are strongly encouraged to provide SRV records or A
  510. records as additional information in terminal NAPTR records.
  511.  
  512. The "a" flag allows the next lookup to be for A records rather than
  513. SRV records. Since there is no place for a port specification in the
  514. NAPTR record, when the "A" flag is used the specified protocol must
  515. be running on its default port. 
  516.  
  517.  
  518. Usage
  519. =====
  520.  
  521. Pseudocode for a client routine using NAPTRs is given below:
  522.  
  523.     //
  524.     // findResolver(URN)
  525.     // Given a URN, find a host that can resolve it.
  526.     // 
  527.     findResolver(string URN) {
  528.       sprintf(key, "%s.urn.net", extractNS(URN));  // prepend prefix to urn.net
  529.       do {
  530.         rewrite_flag = false;
  531.         terminal = false;
  532.     if (key has been seen) {
  533.       quit with a loop detected error
  534.     }
  535.     add key to list of "seens"
  536.     records = lookup(type=NAPTR, key); // get all NAPTR RRs for 'key'
  537.  
  538.         sort NAPTR records by "order" field and "preference" field.
  539.         n_naptrs = number of NAPTR records in response.
  540.         curr_order = records[j].order;
  541.         max_order = records[n_naptrs-1].order;
  542.         
  543.         // Process current batch of NAPTRs according to "order" field.
  544.         for (j=0; j < n_naptrs && records[j].order <= max_order; j++) {
  545.           newkey = rewrite(URN, naptr[j].replacement, naptr[j].regexp);
  546.           if (!newkey) // Skip to next record if the rewrite didn't match
  547.              continue;  
  548.           // We did do a rewrite, shrink max_order to current value
  549.           // so that delegation works properly
  550.           max_order = naptr[j].order;
  551.           // Will we know what to do with the protocol and services
  552.           // specified in the NAPTR? If not, try next record.
  553.           if(!isKnownProto(naptr[j].services)) {
  554.             continue;
  555.           }
  556.           if(!isKnownService(naptr[j].services)) {
  557.             continue;
  558.           }
  559.  
  560.           // At this point we have a sucessful rewrite and we will know
  561.           // how to speak the protocol and request a known resolution
  562.           // service. Before we do the next lookup, check some
  563.           // optimization possibilities.
  564.           
  565.           if (strcasecmp(flags, "S") || strcasecmp(flags, "A")) {
  566.              terminal = true;
  567.              services = naptr[j].services;
  568.              addnl = any SRV and/or A records returned as additional info
  569.                      for naptr[j].
  570.           }
  571.           key = newkey;
  572.           rewriteflag = true;
  573.           break;
  574.         }
  575.       } while (rewriteflag && !terminal);
  576.  
  577.  
  578.       if (!addnl) { // No SRVs came in as additional info, look them up
  579.         srvs = lookup(type=SRV, key);
  580.       }  
  581.  
  582.       sort SRV records by preference, weight, ...
  583.       foreach (SRV record) { // in order of preference
  584.         try contacting srv[j].target using the protocol and one of the
  585.             resolution service requests from the "services" field of the
  586.             last NAPTR record.
  587.         if (successful)
  588.           return (target, protocol, service);
  589.           // Actually we would probably return a result, but this
  590.           // code was supposed to just tell us a good host to talk to.
  591.       }
  592.       die with an "unable to find a host" error;
  593.     }
  594.  
  595.  
  596. Notes:
  597. ======
  598.   -  The "urn:" prefix is a matter of religious controversy. Client
  599.      code should handle the cases when it is and is not present.
  600.      Similarly, if regular expressions are used in NAPTR records, they
  601.      should be immune to the presence or absence of "urn:".
  602.   -  A client MUST examine all the RRs in a reply, not just the first.
  603.      The client MUST process them according to the value of the order field.
  604.      Once a NAPTR has "matched" a URN, the client MUST NOT consider
  605.      any NAPTRs with a higer value of order than that of the matching NAPTR,
  606.      even if it does not know the protocols necessary to talk with the
  607.      matching resolver.
  608.      (A match is defined as:
  609.       1) The NAPTR provides a replacement domain name
  610.       2) The regular expression matches the URN
  611.      )
  612.   -  If a record at a particular order matches the URI, but the client
  613.      doesn't know the specified protocol and service, the client should
  614.      continue to examine records that have the same order. The client
  615.      MUST NOT consider records with a higher value of order. This is
  616.      necesary to make delegation of portions of the namespace work.
  617.   -  When multiple RRs have the same "order", the client should use
  618.      the value of the preference field to select the next NAPTR to
  619.      consider. However, because of preferred protocols or services,
  620.      estimates of network distance and bandwidth, etc. clients
  621.      may use different criteria to sort the records.
  622.   -  If the lookup after a rewrite fails, clients are strongly encouraged
  623.      to report a failure, rather than backing up to pursue other rewrite
  624.      paths.
  625.   -  Note that SRV RRs impose additional requirements on clients.
  626.  
  627.  
  628. Acknowledgements:
  629. =================
  630.  
  631. The authors would like to thank Keith Moore for all his consultations
  632. during the development of this draft. We would also like to thank Paul
  633. Vixie for his assistance in debugging our implementation, and his answers
  634. on our questions.
  635.  
  636.  
  637. References:
  638. ===========
  639.  
  640. [1] RFC-1737 "Functional Requirements for Uniform Resource Names", Karen
  641.     Sollins and Larry Masinter, Dec. 1994.
  642.  
  643. [2] draft-daigle-urn-framework-00.txt "A Uniform Resource Naming
  644.     Framework", Leslie Daigle and Patrik Faltstrom, June, 1996.
  645.  
  646. [3] draft-gulbrandsen-dns-rr-srvcs-03.txt  " A DNS RR for specifying the
  647.     location of services (DNS SRV)",  Arnt Gulbrandsen and Paul Vixie,
  648.     March 1996.
  649.  
  650. [4] Paul Vixie, personal communication.
  651.  
  652. [5] RFC-822 "Standard for the Format of ARPA Internet Text Messages",
  653.     Dave H. Crocker, August 1982.  
  654.  
  655. [6] Keith Moore, personal communication.
  656.  
  657.  
  658. Security Considerations
  659. =======================
  660.   The use of "urn.net" as the registry for URN namespaces is subject to
  661.   denial of service attacks, as well as other DNS spoofing attacks. The
  662.   interactions with DNSSEC are currently being studied. It is expected
  663.   that NAPTR records will be signed with SIG records once the DNSSEC
  664.   work is deployed. 
  665.  
  666.   The rewrite rules make identifiers from other namespaces subject to
  667.   the same attacks as normal domain names. Since they have not been
  668.   easily resolvable before, this may or may not be considered a problem.
  669.  
  670.  
  671. Author Contact Information:
  672. ===========================
  673.  
  674. Ron Daniel
  675. Los Alamos National Laboratory
  676. MS B287
  677. Los Alamos, NM, USA, 87545
  678. voice:  +1 505 665 0597
  679. fax:    +1 505 665 4939
  680. email:  rdaniel@lanl.gov
  681.  
  682.  
  683. Michael Mealling
  684. Office of Information Technology, Network Services
  685. Georgia Institute of Technology
  686. Atlanta, GA, USA 30332-0730
  687. voice:  (404) 894-1712
  688. fax:  (404) 894 9548
  689. michael.mealling@oit.gatech.edu
  690.  
  691.  
  692.  
  693.     This draft expires 16 Feb., 1997.
  694. Ron Daniel Jr.                email: rdaniel@acl.lanl.gov
  695. Advanced Computing Lab        voice: (505) 665-0597
  696. MS B-287  TA-3  Bldg. 2011      fax: (505) 665-4939
  697. Los Alamos National Lab        http://www.acl.lanl.gov/~rdaniel/
  698. Los Alamos, NM,  87545       slogan: "Dump Navigator Now!"